#ifndef BOARD_H
#define BOARD_H

#include <assert.h>

#define BOARD_WIDTH (143)
#define BOARD_HEIGHT (143)
#define BOARD_SIZE (BOARD_WIDTH*BOARD_HEIGHT)

#define CARD_WIDTH (5)
#define CARD_HEIGHT (5)

#define BOARD_PIXEL_W (BOARD_WIDTH*CARD_WIDTH)
#define BOARD_PIXEL_H (BOARD_HEIGHT*CARD_HEIGHT)
#define BOARD_PIXEL_SIZE (BOARD_PIXEL_W*BOARD_PIXEL_H)

#define BOARD_NOT_OCCUPY (-1)
#define BOARD_OUTOF_RANGE (-2)
#define IS_OCCUPY(arg1) (arg1 > 0)
#define IS_NOT_OCCUPY(arg2) (arg2 == BOARD_NOT_OCCUPY)

#define TOP_FLAG(flag)    (flag & 0x00008888)
#define RIGHT_FLAG(flag)  (flag & 0x00004444)
#define BOTTOM_FLAG(flag) (flag & 0x00002222)
#define LEFT_FLAG(flag)   (flag & 0x00001111)


//void set_board_boudary(int x, int y);
void auto_rotate(int idx, int flag, int dir);
int board_occupy(int x, int y);
int get_board_top();
int get_board_right();
int get_board_bottom();
int get_board_left();

#ifdef TEXT_MODE
int *get_board();
void print_board_pixels();
void print_card_pixels(int idx);
#endif
char *get_board_pixels();
void init_board();
void print_board();
void set_board_card(int idx, int board_x, int board_y);
void show_card_image(int idx);
void show_board();
#endif

